package com.chapter1.basic.chain;

import org.junit.Test;

/** 
 * @ClassName: TestMyChain 
 * @Description: 链表测试
 * @author minjun minjun@bw30.com
 * @date 2015-2-12 上午12:26:06 
 *  
 */
public class TestMyChain {

	@Test
	public void testStackChain(){
		MyChainStack<String> chain=new MyChainStack<String>();
		chain.push("jack");
		chain.push("loda");
		chain.push("jonathan");
		
//		System.out.println(chain.pop());
//		System.out.println(chain.pop());
//		System.out.println(chain.pop());
//		System.out.println(chain.pop());
		
		for(String s:chain){
			System.out.println(s);
		}
//		
//		for(String s:chain){
//			System.out.println(s);
//		}
	}
	
	@Test
	public void testQueueChain(){
		MyChainQueue<String> queue=new MyChainQueue<String>();
		queue.enqueue("aaa");
		queue.enqueue("bbb");
		queue.enqueue("ccc");
		
//		System.out.println(queue.dequeue());
//		System.out.println(queue.dequeue());
//		System.out.println(queue.dequeue());System.out.println(queue.dequeue());
		
		for(String s:queue){
			System.out.println(s);
		}
		
//		for(String s:queue){
//			System.out.println(s);
//		}
		
	}
	
	@Test
	public void test1_3_19(){
		Link<String> link=new Link<String>();
		link.add("aaa");
//		link.add("bbb");
//		link.add("ccc");
//		link.add("ddd");
		
		System.out.println(link.removeLast());
		System.out.println(link.removeLast());
	}
}
